home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacFormat 1995 July
/
macformat-026.iso
/
mac
/
Shareware City
/
Developers
/
video-toolbox-95-01-14-c
/
VideoToolbox
/
VideoToolboxSources
/
Uniform.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1993-12-15
|
420 b
|
19 lines
|
[
TEXT/KAHL
]
/*
Uniform.c
UniformSample() returns a random sample from the interval [0,1).
It has a mean of 1/2 and a variance of 1/12.
Also see: Binomial.c, ChiSquare.c, Exponential.c, Normal.c
HISTORY:
12/28/91 dgp extracted it from Normal.c
*/
#include "VideoToolbox.h"
double UniformSample(void)
{
return rand()*(1.0/(RAND_MAX+1.0));
}
/*
The constant is evaluated by the compiler. Multiplication is faster than division.
*/